<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="root">
       <app></app>
    </div>
    <script src="../vue.js"></script>
    <script>
        
        const student = {
            template: `
            <div>
                <h2>{{studentname}}</h2>
                <h2>{{studentage}}</h2>
                </div>`,
            data() {
                return {
                    studentname: '戴阳',
                    studentage: 18
                }
            }
        }

        const school = {
            template: `
            <div>
                <h2>{{schoolname}}</h2>
                <h2>{{schooladdress}}</h2>
                <student></student>
                </div>`,
            data() {
                return {
                    schoolname: '广州新华学院',
                    schooladdress: '东莞'
                }
            },
            components:{
                student
            }
        }


        const hello={
            template:`
            <div>
                <h2>{{name}}</h2>
                </div>`,
                data(){
                    return{
                        name:'欢迎来到尚硅谷学习'
                    }
                }
        }

        const app=Vue.extend({
            template:`
            <div>
                <school></school>
                <hello></hello>
                </div>`,
            components:{
                school,
                hello
            }
        })
        

        new Vue({
            el: '#root',
            components:
            {
                app
            }
        })
    </script>
</body>

</html>